/*
 * @description:
 * @version: 1.0.1
 * @Author: xuqiulin
 * @Date: 2021-04-29 09:42:13
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-04-29 10:40:52
 */
package main

import (
	"fmt"
	"log"
	"time"

	"github.com/BurntSushi/toml"
)

type Animal struct {
	Name    string    `toml:"Name"`
	Age     int64     `toml:"Age"`
	Attr    []string  `toml:"Attr"`
	AttrVal []int64   `toml:"AttrVal"`
	Time    time.Time `toml:"Time"`
}

type MongoDB struct {
	HostPort  string `toml:"HostPort"`
	DataBase  string `toml:"DataBase"`
	UserName  string `toml:"UserName"`
	Password  string `toml:"Password"`
	PoolLimit int64  `toml:"PoolLimit"`
	TimeOut   int64  `toml:"TimeOut"`
}

type Conf struct {
	Animal  Animal  `toml:"Animal"`
	MongoDB MongoDB `toml:"MongoDB"`
}

func main() {
	var conf Conf
	if _, err := toml.DecodeFile("main.conf", &conf); err != nil {
		fmt.Println(1111)
		log.Fatal(err)
	}

	fmt.Printf("%+v\n", conf)
}
